# 函数进阶
# 函数参数默认值
def get_total(a=0, b=0, c=0):
    print(a + b + c)
get_total(6000, 3000, 500)
get_total(6000, 3000)
get_total(6000)
get_total()

# 参数默认值
def mysql_get_connect(host='127.0.0.1', port='3306'):
    pass
mysql_get_connect()

# *args 接受不确定数量的位置参数，格式是元组
def add(*args):
    print(args)
    total = 0
    for item in args:
        total += item
    print(total)
add(1, 2)
add(1, 2, 3, 4, 5)
add(1, 2, 3, 4, 5, 6, 7)

# **kwargs 接收不确定数量的关键字参数，格式是字典
def fn(**kwargs):
    print(kwargs)
    total = 0
    for item in kwargs.values():
        total += item
    print(total)
fn(chines=2000, math=56,english=89, history=800)
fn(chines=789, math=34, thding=90)
fn(a=1, b=2, c=3)
